home *** CD-ROM | disk | FTP | other *** search
- /* *******************************
-
- File: About.c
- Function: Handle all operations for this Modal Dialog
- History: 10/3/89 by Kirk Chase.
-
- ******************************* */
-
- #include "About.h"
- #include "String.h"
- #include "Messenger.h"
-
- pascal Boolean AboutFilter(itemHit, dptr)
- int itemHit;
- DialogPtr dptr;
- {
- return TRUE;
- }
-
- pascal Boolean ExampleFilter(itemHit, dptr)
- int itemHit;
- DialogPtr dptr;
- {
- int itemType;
- Handle item;
- Rect box;
-
- if (itemHit == 2) {
- ParamText("\pThis is changed","\pfor YOUR benefit.", "\p","\pOk?");
- GetDItem(dptr, 3, &itemType, &item, &box);
- InvalRect(&box);
- GetDItem(dptr, 2, &itemType, &item, &box);
- HiliteControl((ControlHandle) item, 255);
- InvalRect(&box);
- }
-
- return FALSE;
- }
-
- void D_About()
- {
- DialogInfo AboutInfo, oldInfo;
- int dummy;
- ProcPtr theFilter;
-
- GetMInfo(&oldInfo);
-
- theFilter = (ProcPtr) &AboutFilter;
-
- AboutInfo.defaultItem = 1;
- AboutInfo.Buttons = 1;
- AboutInfo.dPlace = THIRD;
- AboutInfo.dIcon = noIcon;
- SetRect(&AboutInfo.Button1Rect, 0, 0, 80, 20);
- SetRect(&AboutInfo.TextRect, 0, 0, 140, 30);
- SetRect(&AboutInfo.dRect, 0, 0, 200, 150);
- AboutInfo.Arrange = HORIZONTAL;
- AboutInfo.AddFilter = theFilter;
- strcpy((char *) &AboutInfo.Button1, "\pOK");
- strcpy((char *) &AboutInfo.CharEquiv, "\poOoOoO");
-
- SetMInfo(AboutInfo);
-
- dummy = DoMessage("\pMessenger by Kirk Chase", "\p© 1989 by Kirk Chase", "\pand MacTutor", "\p");
-
- SetMInfo(oldInfo);
- }
-
- void D_Example()
- {
- DialogInfo ExampleInfo, oldInfo;
- int dummy;
- ProcPtr theFilter;
-
- GetMInfo(&oldInfo);
-
- theFilter = (ProcPtr) &ExampleFilter;
-
- ExampleInfo.defaultItem = 1;
- ExampleInfo.Buttons = 2;
- ExampleInfo.dPlace = THIRD;
- ExampleInfo.dIcon = noIcon;
- SetRect(&ExampleInfo.Button1Rect, 0, 0, 50, 20);
- SetRect(&ExampleInfo.Button2Rect, 0, 0, 100, 20);
- SetRect(&ExampleInfo.TextRect, 0, 0, 140, 30);
- SetRect(&ExampleInfo.dRect, 0, 0, 300, 100);
- ExampleInfo.Arrange = VERTICAL;
- ExampleInfo.AddFilter = theFilter;
- strcpy((char *) &ExampleInfo.Button1, "\pOK");
- strcpy((char *) &ExampleInfo.Button2, "\p Change Text");
- strcpy((char *) &ExampleInfo.CharEquiv, "\poOcCoO");
-
- SetMInfo(ExampleInfo);
-
- dummy = DoMessage("\pExample", "\pThis is another", "\pexmaple of", "\pMessenger");
-
- SetMInfo(oldInfo);
- }